home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / Menus.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  5.7 KB  |  189 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Sunday, January 6, 1991 at 10:48 PM
  3.     Menus.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1985-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Menus;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingMenus}
  21. {$SETC UsingMenus := 1}
  22.  
  23. {$I+}
  24. {$SETC MenusIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingQuickdraw}
  27. {$I $$Shell(PInterfaces)Quickdraw.p}
  28. {$ENDC}
  29. {$SETC UsingIncludes := MenusIncludes}
  30.  
  31. CONST
  32. noMark = 0;                             {mark symbol for MarkItem}
  33.  
  34. { menu defProc messages }
  35. mDrawMsg = 0;
  36. mChooseMsg = 1;
  37. mSizeMsg = 2;
  38. mDrawItemMsg = 4;
  39. mCalcItemMsg = 5;
  40. textMenuProc = 0;
  41. hMenuCmd = 27;                          {itemCmd == 0x001B ==> hierarchical menu}
  42. hierMenu = -1;                          {a hierarchical menu - for InsertMenu call}
  43. mPopUpMsg = 3;                          {menu defProc messages - place yourself}
  44. mctAllItems = -98;                      {search for all Items for the given ID}
  45. mctLastIDIndic = -99;                   {last color table entry has this in ID field}
  46.  
  47. TYPE
  48. MenuPtr = ^MenuInfo;
  49. MenuHandle = ^MenuPtr;
  50. MenuInfo = RECORD
  51.     menuID: INTEGER;
  52.     menuWidth: INTEGER;
  53.     menuHeight: INTEGER;
  54.     menuProc: Handle;
  55.     enableFlags: LONGINT;
  56.     menuData: Str255;
  57.     END;
  58.  
  59. MCEntryPtr = ^MCEntry;
  60. MCEntry = RECORD
  61.     mctID: INTEGER;                     {menu ID.  ID = 0 is the menu bar}
  62.     mctItem: INTEGER;                   {menu Item. Item = 0 is a title}
  63.     mctRGB1: RGBColor;                  {usage depends on ID and Item}
  64.     mctRGB2: RGBColor;                  {usage depends on ID and Item}
  65.     mctRGB3: RGBColor;                  {usage depends on ID and Item}
  66.     mctRGB4: RGBColor;                  {usage depends on ID and Item}
  67.     mctReserved: INTEGER;               {reserved for internal use}
  68.     END;
  69.  
  70.  
  71. {}
  72.  
  73. MCTablePtr = ^MCTable;
  74. MCTableHandle = ^MCTablePtr;
  75.  
  76. MCTable = ARRAY [0..0] OF MCEntry;      { the entries themselves }
  77.  
  78. MenuCRsrcPtr = ^MenuCRsrc;
  79. MenuCRsrcHandle = ^MenuCRsrcPtr;
  80. MenuCRsrc = RECORD
  81.     numEntries: INTEGER;                {number of entries}
  82.     mcEntryRecs: MCTable;               {ARRAY [1..numEntries] of MCEntry}
  83.     END;
  84.  
  85.  
  86. SavedBits = LONGINT;                    { For Save/Restore/Discard Bits calls }
  87.  
  88. PROCEDURE InitMenus;
  89.     INLINE $A930;
  90. FUNCTION NewMenu(menuID: INTEGER;menuTitle: Str255): MenuHandle;
  91.     INLINE $A931;
  92. FUNCTION GetMenu(resourceID: INTEGER): MenuHandle;
  93.     INLINE $A9BF;
  94. PROCEDURE DisposeMenu(theMenu: MenuHandle);
  95.     INLINE $A932;
  96. PROCEDURE AppendMenu(menu: MenuHandle;data: Str255);
  97.     INLINE $A933;
  98. PROCEDURE AddResMenu(theMenu: MenuHandle;theType: ResType);
  99.     INLINE $A94D;
  100. PROCEDURE InsertResMenu(theMenu: MenuHandle;theType: ResType;afterItem: INTEGER);
  101.     INLINE $A951;
  102. PROCEDURE InsertMenu(theMenu: MenuHandle;beforeID: INTEGER);
  103.     INLINE $A935;
  104. PROCEDURE DrawMenuBar;
  105.     INLINE $A937;
  106. PROCEDURE InvalMenuBar;
  107.     INLINE $A81D;
  108. PROCEDURE DeleteMenu(menuID: INTEGER);
  109.     INLINE $A936;
  110. PROCEDURE ClearMenuBar;
  111.     INLINE $A934;
  112. FUNCTION GetNewMBar(menuBarID: INTEGER): Handle;
  113.     INLINE $A9C0;
  114. FUNCTION GetMenuBar: Handle;
  115.     INLINE $A93B;
  116. PROCEDURE SetMenuBar(menuList: Handle);
  117.     INLINE $A93C;
  118. PROCEDURE InsMenuItem(theMenu: MenuHandle;itemString: Str255;afterItem: INTEGER);
  119.     INLINE $A826;
  120. PROCEDURE DelMenuItem(theMenu: MenuHandle;item: INTEGER);
  121.     INLINE $A952;
  122. FUNCTION MenuKey(ch: CHAR): LONGINT;
  123.     INLINE $A93E;
  124. PROCEDURE HiliteMenu(menuID: INTEGER);
  125.     INLINE $A938;
  126. PROCEDURE SetItem(theMenu: MenuHandle;item: INTEGER;itemString: Str255);
  127.     INLINE $A947;
  128. PROCEDURE GetItem(theMenu: MenuHandle;item: INTEGER;VAR itemString: Str255);
  129.     INLINE $A946;
  130. PROCEDURE DisableItem(theMenu: MenuHandle;item: INTEGER);
  131.     INLINE $A93A;
  132. PROCEDURE EnableItem(theMenu: MenuHandle;item: INTEGER);
  133.     INLINE $A939;
  134. PROCEDURE CheckItem(theMenu: MenuHandle;item: INTEGER;checked: BOOLEAN);
  135.     INLINE $A945;
  136. PROCEDURE SetItemMark(theMenu: MenuHandle;item: INTEGER;markChar: CHAR);
  137.     INLINE $A944;
  138. PROCEDURE GetItemMark(theMenu: MenuHandle;item: INTEGER;VAR markChar: CHAR);
  139.     INLINE $A943;
  140. PROCEDURE SetItemIcon(theMenu: MenuHandle;item: INTEGER;iconIndex: Byte);
  141.     INLINE $A940;
  142. PROCEDURE GetItemIcon(theMenu: MenuHandle;item: INTEGER;VAR iconIndex: Byte);
  143.     INLINE $A93F;
  144. PROCEDURE SetItemStyle(theMenu: MenuHandle;item: INTEGER;chStyle: Style);
  145.     INLINE $A942;
  146. PROCEDURE GetItemStyle(theMenu: MenuHandle;item: INTEGER;VAR chStyle: Style);
  147. PROCEDURE CalcMenuSize(theMenu: MenuHandle);
  148.     INLINE $A948;
  149. FUNCTION CountMItems(theMenu: MenuHandle): INTEGER;
  150.     INLINE $A950;
  151. FUNCTION GetMHandle(menuID: INTEGER): MenuHandle;
  152.     INLINE $A949;
  153. PROCEDURE FlashMenuBar(menuID: INTEGER);
  154.     INLINE $A94C;
  155. PROCEDURE SetMenuFlash(count: INTEGER);
  156.     INLINE $A94A;
  157. FUNCTION MenuSelect(startPt: Point): LONGINT;
  158.     INLINE $A93D;
  159. PROCEDURE InitProcMenu(resID: INTEGER);
  160.     INLINE $A808;
  161. PROCEDURE GetItemCmd(theMenu: MenuHandle;item: INTEGER;VAR cmdChar: CHAR);
  162.     INLINE $A84E;
  163. PROCEDURE SetItemCmd(theMenu: MenuHandle;item: INTEGER;cmdChar: CHAR);
  164.     INLINE $A84F;
  165. FUNCTION PopUpMenuSelect(menu: MenuHandle;top: INTEGER;left: INTEGER;popUpItem: INTEGER): LONGINT;
  166.     INLINE $A80B;
  167. FUNCTION MenuChoice: LONGINT;
  168.     INLINE $AA66;
  169. PROCEDURE DelMCEntries(menuID: INTEGER;menuItem: INTEGER);
  170.     INLINE $AA60;
  171. FUNCTION GetMCInfo: MCTableHandle;
  172.     INLINE $AA61;
  173. PROCEDURE SetMCInfo(menuCTbl: MCTableHandle);
  174.     INLINE $AA62;
  175. PROCEDURE DispMCInfo(menuCTbl: MCTableHandle);
  176.     INLINE $AA63;
  177. FUNCTION GetMCEntry(menuID: INTEGER;menuItem: INTEGER): MCEntryPtr;
  178.     INLINE $AA64;
  179. PROCEDURE SetMCEntries(numEntries: INTEGER;menuCEntries: MCTablePtr);
  180.     INLINE $AA65;
  181.  
  182.  
  183. {$ENDC}    { UsingMenus }
  184.  
  185. {$IFC NOT UsingIncludes}
  186.     END.
  187. {$ENDC}
  188.  
  189.